package com.tangcl.tclmvvm.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * Created by TCL on 2021/10/8
 *
 * description:
 */
class MainFragmentAdapter : FragmentStateAdapter {
    private var mList: List<Fragment>

    constructor(fragmentManager: FragmentManager, lifecycle: Lifecycle, fragmentList: List<Fragment>) : super(fragmentManager, lifecycle) {
        this.mList = fragmentList
    }

    override fun getItemCount(): Int {
        return mList.size
    }

    override fun createFragment(position: Int): Fragment {
        return mList[position]
    }
}